package com.asialjim.wechat.msgcrypt;

import com.asialjim.wechat.aes.WXBizMsgCrypt;
import com.asialjim.wechat.message.BaseWeChatCallMessage;
import com.asialjim.wechat.message.output.WeChatOutputMessage;
import com.asialjim.wechat.pojo.account.WeChatAccount;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: WxBizMsgCryptService ]</i></h2><strong>
 * <p> wx biz msg crypt service
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/16   &nbsp;&nbsp; JDK 8
 */
public interface WxBizMsgCryptService {

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: wxBizMsgCrypt ]</i></h3>
     * 根据微信公众平台账号获取加解密实体
     * @param accountId {@link String account id}
     * @return {@link WXBizMsgCrypt crypt}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/16 14:58
     */
    WXBizMsgCrypt wxBizMsgCrypt(String accountId);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: decrypt ]</i></h3>
     * 解密腾迅服务器向开发者服务器推送的加密消息
     * @param callMessage {@link BaseWeChatCallMessage call message}
     * @param msgSignature {@link String msg signature}
     * @param timestamp {@link String timestamp}
     * @param nonce {@link String nonce}
     * @return {@link BaseWeChatCallMessage call message was decrypted}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/16 14:59
     */
    BaseWeChatCallMessage decrypt(BaseWeChatCallMessage callMessage, String msgSignature, String timestamp, String nonce);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: encrypt ]</i></h3>
     * 加密消息
     * @param outputMessage {@link WeChatOutputMessage out put message}
     * @param account {@link WeChatAccount we chat account}
     * @param encrypt {@link String encrypt}
     * @param signature {@link String signature}
     * @param timestamp {@link String timestamp}
     * @param nonce {@link String nonce}
     * @return {@link String message encrypted}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/16 15:01
     */
    String encrypt(WeChatOutputMessage outputMessage, WeChatAccount account, String encrypt, String signature, String timestamp, String nonce);
}
